<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/


/**
* Smarty insert_hipen modifier plugin
*
* Type:     modifier<br>
* Name:     insert_hipen<br>
* Purpose:  to replace white space with hipen
* @author   Monte Ohrt <monte at ohrt dot com>
* @param string
* @param string
* @return string
*/

function smarty_modifier_hot_link($string)
{
		//check whether url ispresent in text posted
		$explode_comment=explode(" ",$string);
		for($ec=0;$ec<count($explode_comment);$ec++)
		{
			if(strstr(strtolower($explode_comment[$ec]),"http://"))
				{
					$explode_comment[$ec]="<a target='_blank' href='".$explode_comment[$ec]."'>".$explode_comment[$ec]."</a>";
				    $url="true";
				}
			elseif(strstr(strtolower($explode_comment[$ec]),"www."))
				{
					$explode_comment[$ec]="<a target='_blank' href='http://".$explode_comment[$ec]."'>".$explode_comment[$ec]."</a>";
				    $url="true";
				}elseif(strstr(strtolower($explode_comment[$ec]),".com"))
				{
					$explode_comment[$ec]="<a target='_blank' href='http://".$explode_comment[$ec]."'>".$explode_comment[$ec]."</a>";
				    $url="true";
				}
				else
				{
					$explode_comment[$ec]=$explode_comment[$ec];
				}
		}
		$implode_exploded=@implode(" ",$explode_comment);
		return $implode_exploded;
	//spe^&amp;*( charsÂ£$%&amp; removed from !URL234&quot;&quot;&quot;
}
/* vim: set expandtab: */
				  
?>